package com.memd.morp
{
	import com.memd.morp.controller.StartupCommand;
	
	import org.puremvc.as3.interfaces.IFacade;
	import org.puremvc.as3.patterns.facade.Facade;

	public class MorpFacade extends Facade implements IFacade
	{
		public static const DEFAULT_KEY:String="MorpKey";

		// Define Notification name constants

		public function MorpFacade(key:String=DEFAULT_KEY)
		{
			super();
			//traceGSKDSPFacade, 'constructor invoked');
		}

		// Register Commands with the Controller  
		override protected function initializeController():void
		{
			super.initializeController();
			trace(MorpFacade, 'initializeController invoked');
			registerCommand(ApplicationConstants.STARTUP, StartupCommand);

		}
		
		public static function getInstance():MorpFacade{
			if ( instance == null ) instance = new MorpFacade( );
			return instance as MorpFacade;
		}

		// Startup the PureMVC apparatus, passing in a reference to the application  
		public function startup(app:Morp):void
		{
			trace(MorpFacade, 'startup invoked');
			//registerMediator(new EdetailMediator(EdetailMediator.NAME,app));
			sendNotification(ApplicationConstants.STARTUP, app);
		}

	}
}